Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development


lookupEntry event

On entry of the lookup field, the enterlookup procedure in the lookup support procedure lookup.p publishes lookupEntry with the following parameters:

DEFINE INPUT PARAMETER pcScreenValue        AS CHARACTER    NO-UNDO. 
DEFINE INPUT PARAMETER phlookup             AS HANDLE       NO-UNDO. 

A description of the parameters follows:

The handle of the lookup instance is useful when your viewer contains multiple lookups and you must determine which lookup caused your hook to fire.

To use this event, add a procedure to your viewer’s custom super procedure with the name lookupEntry and the above parameters.

Using PUBLISH and SUBSCRIBE properly in super procedures

In initializeObject in the super procedure supporting the lookup, before the RUN SUPER statement, subscribe your viewer to the event using the following statement:

SUBSCRIBE PROCEDURE TARGET-PROCEDURE TO "lookupEntry":U IN TARGET-PROCEDURE. 

Note the format of this SUBSCRIBE statement carefully. It is essential that you always keep in mind that events should almost never be published by or directly subscribed to in super procedures. The super procedure acts in the background on behalf of application objects such as viewers. Thus a SUBSCRIBE statement in a super procedure will normally be qualified by PROCEDURE TARGET-PROCEDURE, meaning that the subscription is registered on behalf of the viewer or other object, not the super procedure itself. And the event will also be qualified by IN TARGET-PROCEDURE, meaning that the interpreter will respond when the event occurs in the viewer or other object, not in the super procedure. Likewise, a PUBLISH statement in super procedure code should normally be in the following form:

PUBLISH <event-name> FROM TARGET-PROCEDURE. 

In this way the interpreter responds to the event as if it had actually come from the supported SmartObject and not from the super procedure itself. Forgetting these forms can cause problems, such as when events do not seem to occur or are not responded to properly.

The lookupEntry event is used within the lookup super procedure lookup.p itself to save the current screen value of the lookup so that on leave of the lookup you can see if it has been programmatically changed and allow the standard lookup code to fire, validating the new value. Possible uses in application-specific code could be for programmatic manipulation of properties at run time, or possibly customization of the value based on the value of other fields on your viewer.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095